class Ftr:
    def __init__(self):
        self.BAR_CODE="23BS217322-16"
ftr=Ftr()
def left(s,n):
    return s[:n]
def right(s,n):
    return s[len(s)-n:]
def CHARINDEX(char,s):
    return s.index(char)+1
def REVERSE(s):
    return s[::-1]
print(left("123",2))
print(right("123",2))
print(CHARINDEX("2","123"))
print(REVERSE(ftr.BAR_CODE))
at=CHARINDEX('-', REVERSE(ftr.BAR_CODE))
print(at)
print(right(ftr.BAR_CODE,CHARINDEX('-', REVERSE(ftr.BAR_CODE))-1))# as num,
print(left(ftr.BAR_CODE,CHARINDEX('-', ftr.BAR_CODE)-1))#as pre
